   

# some string functions with examples  

#substring function 

    my $s = "The black cat climbed the green tree";
     my $first=substr $s, 4, 5;      # black
    my $middle = substr $s, 4, -11;    # black cat climbed the
    my $end    = substr $s, 14;        # climbed the green tree
    my $tail   = substr $s, -4;        # tree
    my $z      = #substr $s, -4, 2;     # tr
 

print $first,"\n";
print $middle ,"\n";
print $end  ,"\n";
print $tail ,"\n";
print $z ,"\n";




#String length function
 
$myString = 'perl.programs by...sravan';
 $myLength = length($myString); 

 
#string index function return position  for partcular portion 
my $string = 'matrusri pg studiesssss';
  my $char = 'tru';

  my $result = index($string, $char);

  print "Result: $result\n";



#string uppercase
print (uc($string)) ,"\n";;

#string firstletter is uppercase
print (ucfirst($string)),"\n";



#string join function
@ARRAY = {1,2,3,4};

print (join($string, $ARRAY)) 






